<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>

<head>
<title>Zoek resultaten</title>
<style type="text/css">
.paginaLink A:link {
	text-decoration: none;
	color: #ffffff;
}

.paginaLink A:visited {
	text-decoration: none;
	color: #ffffff;
}

.paginaLink A:active {
	text-decoration: none;
	color: #1e304d;
}

.paginaLink A:hover {
	text-decoration: underline;
	color: red;
}

#resultatenTabel {
	width: 100%;
	border-collapse: collapse;
}

#resultatenTabel td {
	height:80px;
	border: none;
	padding: 3px 7px 2px 7px;
}

#resultatenTabel th {
	border: none;
	font-size: 1.1em;
	text-align: left;
	padding-top: 5px;
	padding-bottom: 4px;
	background-color: #1c478e;
	color: #ffffff;
}
</style>
</head>

<body>
	<script>
		function ChangeColor(tableRow, highLight) {
			if (highLight) {
				tableRow.style.backgroundColor = '#5d6b82';
			} else {
				tableRow.style.backgroundColor = '';
			}
		}

		function DoNav(theUrl) {
			document.location.href = theUrl;
		}
	</script>
	<table id="resultatenTabel">
		<tr class="thcolor">
			<th></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'titel'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Titel
			</a></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'startprijs'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Startprijs
			</a></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'laatste_bod'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Laatste bod
			</a></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'einddatum'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Sluit datum
			</a></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'categorie'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Categorie
			</a></th>
			<th class="paginaLink"><a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="sorterenOp" value="'aantal_biedingen'"></s:param><s:param name="resultaatVan"><s:property value="resultaatVan" /></s:param><s:param name="resultaatTot"><s:property value="resultaatTot" /></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
					<s:property value="#counter.current" />Aantal biedingen
			</a></th>
		</tr>
		<s:iterator value="veilingen">
			<tr class="tdcolor" onmouseover="ChangeColor(this, true)"
				onmouseout="ChangeColor(this, false)"
				onclick="DoNav('<s:url action="showVeiling" namespace="/member"><s:param name="veilingId"><s:property value="veilingId" /></s:param></s:url>')">
				<td><img style="max-width: 120px; max-height: 80px;"
					src="../plaatjes/<s:property value="fotoUrl" />"/></td>
				<td><s:property value="titel" /></td>
				<td><s:property value="startprijs" /></td>
				<td><s:property value="laatsteBod" /></td>
				<td><s:property value="getFormattedEindDatum()" /></td>
				<td><s:property value="categorie" /></td>
				<td><s:property value="aantalBiedingen" /></td>
			</tr>
		</s:iterator>

	</table>
	<!-- 	(aantalPaginas - 1) in de counter bean geeft soms onverwacht resultaat, vandaar de variabele "paginas" -->
	<s:set name="paginas" value="aantalPaginas - 1" />
	<s:if test="#paginas < 0">
		<s:set name="paginas" value="0" />
	</s:if>

	<s:bean name="org.apache.struts2.util.Counter" id="counter">
		<s:param name="last" value="paginas" />
	</s:bean>
	<span class="paginaLink"> Pagina: <a
		href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="resultaatVan" value="1"></s:param><s:param name="resultaatTot" value="resultatenPerPagina"></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="sorterenOp"><s:property value="sorterenOp" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
			<s:property value="#counter.current" />
	</a> <s:iterator value="#counter">
			<a
				href="<s:url action="ZoekBalkSearch" namespace="/member"><s:param name="resultaatVan" value="(#counter.current * resultatenPerPagina) - (resultatenPerPagina - 1)"></s:param><s:param name="resultaatTot" value="(#counter.current * resultatenPerPagina)"></s:param><s:param name="categorieNaam"><s:property value="categorieNaam" /></s:param><s:param name="minBedrag"><s:property value="minBedrag" /></s:param><s:param name="maxBedrag"><s:property value="maxBedrag" /></s:param><s:param name="zoekwoord"><s:property value="zoekwoord" /></s:param><s:param name="zoekdiepte"><s:property value="zoekdiepte" /></s:param><s:param name="sorterenOp"><s:property value="sorterenOp" /></s:param><s:param name="resultatenPerPagina"><s:property value="resultatenPerPagina" /></s:param></s:url>">
				<s:property value="#counter.current" />
			</a>
		</s:iterator>
	</span>

	<hr />
	<hr />
	<s:form action="ZoekBalkSearch">
		<s:select name="resultatenPerPagina" list="{5,10,20,50,100}" value="%{resultatenPerPagina}"
			label="Resultaten per pagina" />
			<s:hidden name="categorieNaam" value="%{categorieNaam}" />
			<s:hidden name="minBedrag" value="%{minBedrag}" />
			<s:hidden name="maxBedrag" value="%{maxBedrag}" />
			<s:hidden name="zoekwoord" value="%{zoekwoord}" />
			<s:hidden name="zoekdiepte" value="%{zoekdiepte}" />
			<s:hidden name="sorterenOp" value="%{sorterenOp}" />
		<s:submit value="Verander"/>
	</s:form>
	<s:if test="hasActionMessages()">
		<s:actionmessage />
	</s:if>
</body>
</html>
